﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;


namespace KPIS.GERP.GBMS.APP_UI
{
    public partial class Check : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           /* if(!IsPostBack){

               if($_POST['code'] == '$bgm_source_code'){
                    echo true;
                }else{
                    echo false;

            }
          } */

            MySqlConnection conn = new MySqlConnection("Server=localhost; Database=gerp;Uid=root;Pwd=root123456789;");
            string query = "SELECT p.SPOUSE_SEQ, p.EMP_SEQ, p.NAME_PREFIX_SEQ, p.SPOUSE_NAME, p.SPOUSE_LAST_NAME, p.SPOUSE_STATUS, CASE p.SPOUSE_STATUS  WHEN '1' THEN 'อยู่ด้วยกัน' WHEN '2' THEN 'หย่าร้าง' WHEN '3' THEN 'เสียชีวิต' ELSE 'อื่นๆ' END AS SPOUSE_STATUS_NAME, p.EARNING_STATUS, p.RECORD_STATUS, p.CREATED_BY, p.UPDATED_BY, CONCAT(p.SPOUSE_NAME, '  ', p.SPOUSE_LAST_NAME) AS FULL_NAME, p.CITIZEN FROM HRM_PS_EMP_SPOUSES p ";
            MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
            DataTable dt = new DataTable();
            adapter.Fill(dt);

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if(Page.IsValid){
                Response.Write("Sucess");
            }

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            Label1.Text = TextBox1.Text = "Hellow wold!";
            string jsSript = "alert(document.forms[0]['TextBox1'].value)";
            Page.ClientScript.RegisterStartupScript(GetType(), "Script", jsSript, true);

        }

     }
}